<?php

namespace ;

use TestService;
use Slowlyo\OwlAdmin\Controllers\AdminController;

/**
 * 测试
 *
 * @property TestService $service
 */
class TestController extends AdminController
{
	protected string $serviceName = TestService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('name', '名称')->searchable(1),
				amis()->TableColumn('appid', 'Appid'),
				amis()->TableColumn('created_at', admin_trans('admin.created_at'))->type('datetime')->sortable(),
				amis()->TableColumn('updated_at', admin_trans('admin.updated_at'))->type('datetime')->sortable(),
				$this->rowActions('page')
			]);

		return $this->baseList($crud);
	}

	public function form($isEdit = false)
	{
		return $this->baseForm()->body([
			amis()->TextControl('name', '名称'),
			amis()->TextControl('appid', 'Appid'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('name', '名称')->static(),
			amis()->TextControl('appid', 'Appid')->static(),
			amis()->TextControl('created_at', admin_trans('admin.created_at'))->static(),
			amis()->TextControl('updated_at', admin_trans('admin.updated_at'))->static(),
		]);
	}
}